package com.chagee.channel.api.utils;

import org.springframework.util.CollectionUtils;

import javax.validation.ConstraintViolation;
import java.util.Set;

/**
 * 请求字段校验
 * @author yangyang
 * @date 2024/3/30-17:46
 **/
public class Jsr303Util {

	public static String validate(Set<ConstraintViolation<Object>> validate) {
		if (!CollectionUtils.isEmpty(validate)) {
			for (ConstraintViolation<Object> objectConstraintViolation : validate) {
				return objectConstraintViolation.getMessage();
			}
		}
		return null;
	}
}
